import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '@/views/Home';

import Login from '@/views/Login';
import PostList from '@/views/PostList';
import EditPost from '@/views/EditPost';

Vue.use(VueRouter);

const routes = [
	{
		meta: {
			breadcrumb: '首页'
		},
		path: '/',
		redirect: '/postlist',
		name: 'Home',
		component: Home,
		children: [
			{
				meta: {
					breadcrumb: '文章页'
				},
				path: 'postlist',
				component: PostList
			},
			{
				meta: {
					breadcrumb: '编辑页'
				},
				path: 'editpost',
				component: EditPost
			}
		]
	},
	{
		path: '/login',
		name: 'LoginPage',
		component: Login
	}
];

const router = new VueRouter({
	routes
});

export default router;
